{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "5e1ee98b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "max_len=173, min_len=6, avg_len=42.332, seq_num=500, train_num=300, dev_num=100, test_num=100, num_types=3\n"
     ]
    }
   ],
   "source": [
    "from data import load_data_hym\n",
    "\n",
    "\n",
    "dataname = 'hawkes'\n",
    "\n",
    "train_data = load_data_hym(dataname, 'train')\n",
    "dev_data = load_data_hym(dataname, 'dev')\n",
    "test_data = load_data_hym(dataname, 'test')\n",
    "max_len = max([train_data.max_length(), dev_data.max_length(), test_data.max_length()])\n",
    "min_len = min([train_data.mask.sum(1).min(), dev_data.mask.sum(1).min(), test_data.mask.sum(1).min()])\n",
    "avg_len = (train_data.mask.sum() + dev_data.mask.sum() + test_data.mask.sum()) / (len(train_data) + len(dev_data) + len(test_data))\n",
    "seq_num = len(train_data) + len(dev_data) + len(test_data)\n",
    "train_num = len(train_data)\n",
    "dev_num = len(dev_data)\n",
    "test_num = len(test_data)\n",
    "num_types = max([train_data.num_types(), dev_data.num_types(), test_data.num_types()])\n",
    "print(f'max_len={max_len}, min_len={min_len}, avg_len={avg_len}, seq_num={seq_num}, train_num={train_num}, dev_num={dev_num}, test_num={test_num}, num_types={num_types}')\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "e4af06fd",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "205.28374335123226 0.6172593760647335 2.6308089111249813\n"
     ]
    }
   ],
   "source": [
    "from data import load_data_hym\n",
    "import numpy as np\n",
    "\n",
    "dataname = 'taobao'\n",
    "\n",
    "train_data = load_data_hym(dataname, 'train')\n",
    "dev_data = load_data_hym(dataname, 'dev')\n",
    "test_data = load_data_hym(dataname, 'test')\n",
    "\n",
    "dts = train_data.all_dts() + dev_data.all_dts() + test_data.all_dts()\n",
    "\n",
    "max_dt = np.max(dts)\n",
    "min_dt = np.min(dts)\n",
    "mean_dt = np.mean(dts)\n",
    "std_dt = np.std(dts)\n",
    "print(max_dt, mean_dt, std_dt)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "60439154",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "np.int64(21166)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from data import load_data_hym\n",
    "import numpy as np\n",
    "\n",
    "dataname = 'hawkes'\n",
    "\n",
    "train_data = load_data_hym(dataname, 'train')\n",
    "dev_data = load_data_hym(dataname, 'dev')\n",
    "test_data = load_data_hym(dataname, 'test')\n",
    "\n",
    "event_num = train_data.mask.sum() + dev_data.mask.sum() + test_data.mask.sum()\n",
    "\n",
    "event_num"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([5., 1., 2.], dtype=float32)"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import numpy as np\n",
    "path = './my_datasets'\n",
    "with open(f'{path}/poisson/poisson.npy', 'rb') as f:\n",
    "    params = np.load(f)\n",
    "    mus = np.asarray(params['mus'])\n",
    "    t_max = params['t_max']\n",
    "mus"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "94987b63",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(array([0.5, 0.4, 0.3], dtype=float32),\n",
       " array([[1. , 0.5, 0.5],\n",
       "        [0.5, 1. , 0.5],\n",
       "        [0.5, 0.5, 1. ]], dtype=float32),\n",
       " array([[2., 4., 4.],\n",
       "        [4., 2., 4.],\n",
       "        [4., 4., 2.]], dtype=float32),\n",
       " array(10))"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import numpy as np\n",
    "with open(f'{path}/hawkes/hawkes.npy', 'rb') as f:\n",
    "    params = np.load(f)\n",
    "    As = np.asarray(params['As'])\n",
    "    aa = np.asarray(params['aa'])\n",
    "    mus = np.asarray(params['mus'])\n",
    "    t_max = params['t_max']\n",
    "mus, As, aa, t_max"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "my-env (3.11.5)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
